import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 获取列表 */
export const getArticleAttributesGroups = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/portal/admin/article_attributes_groups'),
    {
      params,
    },
  );
};

/** 添加 */
export const postArticleAttributesGroups = (data?: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/article_attributes_groups'),
    data,
  );
};

/** 获取信息 */
export const getArticleAttributesGroupsInfo = (data: { id: number }) => {
  return requestClient.get<Result>(
    baseUrlApi(`/portal/admin/article_attributes_groups/${data.id}`),
  );
};

/** 编辑 */
export const putArticleAttributesGroups = (id: number, data: any) => {
  return requestClient.put<Result>(
    baseUrlApi(`/portal/admin/article_attributes_groups/${id}`),
    data,
  );
};

/** 删除 */
export const deleteArticleAttributesGroups = (id?: number) => {
  return requestClient.delete<Result>(
    baseUrlApi(`/portal/admin/article_attributes_groups/${id}`),
  );
};

/** 设置状态 */
export const postArticleAttributesGroupsStatus = (data: { id: number }) => {
  return requestClient.post<Result>(
    baseUrlApi(`/portal/admin/article_attributes_groups/${data.id}/status`),
    data,
  );
};

/** 后台菜单排序 */
export const postArticleAttributesGroupsListOrder = (data?: {
  list_orders: object;
}) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/article_attributes_groups/list/order'),
    data,
  );
};
